<div class="box1000 albums">
	<div class="msg"></div>
	<?php foreach($lists as $v) { ?>
	<a href="<?=site_url('detail?aid='.$v['id'])?>" class="album" target="_blank">
		<?php if($v['top'] == 1) { ?>
		<span class="best"></span>
		<?php } ?>

		<?php if(get_cookie('uid')) { ?>
		<span data-href="<?=site_url('index/setTop?aid='.$v['id'])?>" class="setTop">推荐</span>
		<?php } ?>
		<img src="<?=get_thumb($v['cover'])?>" />
		
		<div class="title"><?=$v['title']?></div>
		<div class="image_info">
			<?=date('Y-m-d', strtotime($v['ctime']))?>&nbsp;&nbsp;
			数量:<?=$v['total']?>&nbsp;&nbsp;
			阅读:<?=$v['hits']?>
		</div>		
	</a>
	<?php } ?>
	<div class="clear10"></div>
	<?=$pagination?>
</div>

<script type="text/javascript">

	var isMobile = "<?=$isMobile?>";

	$(function() {
		/*
		$('.album').hover(
			function () {
				$(this).find('.image_info').show('fast');
			},
			function () {
				$(this).find('.image_info').hide('fast');
			}
		);*/
		reSizeWidth() 

		$(window).resize(function(){
  			reSizeWidth();
		});

		$('.setTop').click(function() {
			$.get($(this).attr('data-href'), {}, function(data) {
				if(data) {
					$('.msg').html('设置成功！').show().delay(2000).fadeOut();
				} else {
					$('.msg').html('设置失败！').show().delay(2000).fadeOut();
				}
			});
			return false;
		});		
	});

	function reSizeWidth() {
		var windowWidth = $(window).width();

		if(isMobile) {
			var lineNum = parseInt((windowWidth-20)/236);
		} else {
			var lineNum = parseInt((windowWidth-300)/236);
		}
		
		if(lineNum > 6) {
			lineNum = 6;
		} 

		console.log(lineNum);
		console.log(lineNum*236);
		$('.albums').width(lineNum*236);
	}
</script>